﻿using System;
using System.Windows.Forms;

namespace IMS.PresentationLayer
{
    public partial class MainForm : Form
    {
        #region Variable

        private delegate void ShowUserControlDelegate(UserControl userControl);
        private delegate void ShowFormDelegate(Form form);

        private ShowUserControlDelegate _showUserControlDelegate;
        private ShowFormDelegate _showFormDelegate;

        #endregion

        #region Constructor
        public MainForm()
        {
            InitializeComponent();
        }
        #endregion

        private void ShowUserControl(Control userControl)
        {
            panelLeft.Controls.Clear();
            panelLeft.Controls.Add(userControl);
            userControl.Dock = DockStyle.Fill;
        }

        private void ShowForm(Form form)
        {
            form.MdiParent = this;
            form.Show();
        }

        private void userManagementToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Settings.Users.FormUserManagement umf = new Settings.Users.FormUserManagement()
            {
                WindowState = FormWindowState.Maximized
            };
            _showFormDelegate = new ShowFormDelegate(ShowForm);
            _showFormDelegate(umf);
        }      

    }
}
